Remove dependency between domain db and path/uuid.
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Fri, 9 Sep 2005 16:07:26 +0000 (16:07 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Fri, 9 Sep 2005 16:07:26 +0000 (16:07 +0000)
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
tools/python/xen/xend/XendDomainInfo.py

index 1100d28b850e12300d2150b302df98bb9bb72989..8c171d8e4bfe15267e7cc62003ed778374bc2ab2 100644 (file)
@@ -156,7 +156,8 @@ class XendDomainInfo:
         """
         uuid = getUuid()
         db = parentdb.addChild(uuid)
-        vm = cls(db)
+        path = parentdb.getPath()
+        vm = cls(uuid, path, db)
         vm.construct(config)
         vm.saveToDB(sync=True)
 
@@ -171,7 +172,8 @@ class XendDomainInfo:
         @param info:      domain info from xc
         """
         dom = info['dom']
-        vm = cls(db)
+        path = "/".join(db.getPath().split("/")[0:-1])
+        vm = cls(db.getName(), path, db)
         vm.setdom(dom)
         db.readDB()
         vm.importFromDB()
@@ -206,7 +208,8 @@ class XendDomainInfo:
         if not uuid:
             uuid = getUuid()
         db = parentdb.addChild(uuid)
-        vm = cls(db)
+        path = parentdb.getPath()
+        vm = cls(uuid, path, db)
         ssidref = int(sxp.child_value(config, 'ssidref'))
         log.debug('restoring with ssidref='+str(ssidref))
         id = xc.domain_create(ssidref = ssidref)
@@ -239,9 +242,10 @@ class XendDomainInfo:
         DBVar('device_model_pid', ty='int'),
         ]
     
-    def __init__(self, db):
+    def __init__(self, uuid, path, db):
+        self.uuid = uuid
+        self.path = path + "/" + uuid
         self.db = db
-        self.uuid = db.getName()
 
         self.recreate = 0
         self.restore = 0